﻿using System.Collections.Generic;
using Model_SSResourceManager;
using System;

namespace Presenter_SSResourceManager
{
   public class PresenterBooking
    {
        private readonly IViewBooking _viewBooking;
        private readonly ModelsManager _mModel;

        public PresenterBooking(IViewBooking view)
        {
            _viewBooking = view;
            _mModel = ModelInstanse.Get();
        }

        public List<string[]> CheckAvailable(Queue queue)
        {
            return _mModel.queueModel.CheckAvaiable(queue);
        }

        public void AddQueue()
        {
           Queue queue = _viewBooking.GatherQueuesFields();
            _mModel.queueModel.Add(queue);
        }

       public void FillQueueFildsbyPattern(Guid userId, Guid resourceId)
        {
            _viewBooking.FillResourceFilds(_mModel.resourceModel.Get(resourceId)); //this must be before FillFieldsQueue()
            _viewBooking.FillFieldsQueue(_mModel.queueModel.Create(userId, resourceId)); //this must be after FillResourceFilds()
        }


       public DateTime? GetUserMessageSetting(Guid userId, DateTime dateTime)
       {
           return dateTime -_mModel.userModel.Get(userId).MessageTimeSpan;
       }

       
    }
}
